package org.sca.middle.cmpe.dto;

import java.io.Serializable;
import java.util.Date;

import org.sca.middle.cmpe.common.MarshalType;

/**
 * <p>Updated 3/6/2014: Fixed The serializable class Authorization does not declare a static final serialVersionUID field of type long</p>
 * <p>Updated 4/28/2014: Added properties category, martial, and marshaltype.</p>
 * @author rik
 * @author Kevin Carlen
 * @version 1.1
 */
public class Authorization implements Serializable {
    /**
	 * UID for {@link java.io.Serializable}
	 */
	private static final long serialVersionUID = -6203922768695639329L;

	/** authorization code */
	private String code;
    
    /** authorization description */
    private String description;
    
    /** authorization date */
    private Date date;
    
    /** authorization category */
    private AuthCategory category;
    
    /** Is a marshal authorization */
    private boolean martial;
    
    /** the type of martial */
    private MarshalType marshaltype;
    
    /** the sort order */
	private Long orderValue;

    /**
     * @return the authorization code
     */
    public String getCode() {
        return code;
    }

    /**
     * @param code the authorization code to set
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @return the date of the authorization
     */
    public Date getDate() {
        return date;
    }

    /**
     * @param date the date of the authorization to set
     */
    public void setDate(Date date) {
        this.date = date;
    }

    /**
     * @return the description of the authorization
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description of the authorization to set
     */
    public void setDescription(String description) {
        this.description = description;
    }


    /**
	 * @return the category of the authorization
	 */
	public AuthCategory getCategory() {
		return category;
	}

	/**
	 * @param category the category of the authorization to set
	 */
	public void setCategory(AuthCategory category) {
		this.category = category;
	}

	/**
	 * @return whether this is a martial authorization
	 */
	public boolean isMartial() {
		return martial;
	}

	/**
	 * @param martial is this a martial authorization
	 */
	public void setMartial(boolean martial) {
		this.martial = martial;
	}

	/**
	 * @return the marshaltype
	 */
	public MarshalType getMarshaltype() {
		return marshaltype;
	}

	/**
	 * @param marshaltype the marshaltype to set
	 */
	public void setMarshaltype(MarshalType marshaltype) {
		this.marshaltype = marshaltype;
	}

	/**
	 * @return the order of this authorization
	 */
	public Long getOrderValue() {
		return orderValue;
	}

	/**
	 * @param orderValue the order of the authorization to set
	 */
	public void setOrderValue(Long orderValue) {
		this.orderValue = orderValue;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		int hash = 7;
		hash = 83 * hash + (this.code != null ? this.code.hashCode() : 0);
		hash = 83 * hash + (this.description != null ? this.description.hashCode() : 0);
		hash = 83 * hash + (this.date != null ? this.date.hashCode() : 0);
		hash = 83 * hash + (this.orderValue != null ? this.orderValue.hashCode() : 0);
		return hash;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		final Authorization other = (Authorization) obj;
		if ((this.code == null) ? (other.code != null) : !this.code.equals(other.code)) {
			return false;
		}
		if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
			return false;
		}
		if (this.orderValue != other.orderValue && (this.orderValue == null || !this.orderValue.equals(other.orderValue))) {
			return false;
		}
		return true;
	}
	

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "Authorization{" + "code=" + code + ", description=" + description + ", date=" + date + '}';
    }

	
    
}
